import {Vertex2} from "../Math2D/Direction2D";

class SizeRoot {
    protected _minX = 0; protected _minY = 0;
    protected _maxX = 0; protected _maxY = 0;

    get middle() {
        return [this._minX + (this._maxX - this._minX) / 2,
            this._minY + (this._maxY - this._minY) / 2] as Vertex2
    }

    get width() {
        return this._maxX - this._minX;
    }

    get height() {
        return this._maxY - this._minY;
    }

    protected ResetSizeRoot = () => {
        this._minX = 0; this._minY = 0;
        this._maxX = 0; this._maxY = 0;
    }

    GetRangeInfo = () => {
        return {
            sMinX: this._minX, sMinY: this._minY, sMaxX: this._maxX, sMaxY: this._maxY
        }
    }
}

export {SizeRoot};